/**
 * All Rights Reserved , Copyright (C) 2022 , 青岛鼎信通讯股份有限公司
 *
 *MmsProductFloorPriceInfoController
 * 产品红线价格信息表
 *
 * 修改纪录
 * 2022-05-24 版本：1.0 hudeyong 创建。
 * @version 版本：1.0
 * @author 作者：hudeyong
 * 创建日期：2022-05-24
 */

package com.topscomm.mms.controller;

import java.util.Map;

import com.topscomm.pub.util.ConvertUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.topscomm.mms.controller.auto.MmsProductFloorPriceInfoControllerAuto;
import com.topscomm.pub.util.StringBufferProxy;
import com.topscomm.pub.util.StringUtil;
import com.topscomm.pub.vo.ResponseResult;

/**
 * @author: hudeyong
 * @date: 2022-05-24
 * @description:产品红线价格信息表Controller
 * @modify:
 */
@RestController
@RequestMapping("mms/productFloorPriceInfo")
public class MmsProductFloorPriceInfoController extends MmsProductFloorPriceInfoControllerAuto implements IMmsProductFloorPriceInfoController {
	/**
	 * @author: hudeyong
	 * @date: 2022-05-24
	 * @param paraMap
	 * @return
	 * @description:转换出查询SQL语句
	 * @modify:
	 */
	@Override
	protected String spellListSql(Map<String, Object> paraMap) {
		StringBufferProxy sql = new StringBufferProxy();
		sql.appendSingle(" 1=1 ");
		if (paraMap.containsKey("qry_productid")) {
			String value = paraMap.get("qry_productid").toString();
			if (!StringUtil.isEmpty(value))
				sql.appendSingle(" and productid = '{0}' ", value);
		}
		return sql.toString();
	}

	/**
	 * @author: hudeyong
	 * @date: 2022-05-24
	 * @param paraMap
	 * @return
	 * @description:转换出查询SQL语句
	 * @modify:
	 */
	@Override
	@GetMapping(value = "/refList")
	public ResponseResult<Object> refList(@RequestParam(required = false) Map<String, Object> paraMap) {
		return super.refList(paraMap);
	}

	/**
	 * @description: 产品发布
	 * @param paraMap
	 * @return com.topscomm.pub.vo.ResponseResult<java.lang.Object>
	 * @author: wangxinhua
	 * @date: 2022/6/20 10:38
	 * @modify:
	 */
	@GetMapping(value = "/publish")
	public ResponseResult<Object> publish(@RequestParam(required = false) Map<String, Object> paraMap) {
		try {
			this.service.publishProduct(ConvertUtil.convertToString(paraMap.get("id")));
			return ResponseResult.ok("成功");
		} catch (Exception ex) {
			return handleControllerException(ex);
		}
	}
}

